package servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import entity.User;
import service.IUserService;
import serviceimpl.UserServiceImpl;


@WebServlet("/QueryUserByIdServlet")
public class QueryUserByIdServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 int id=Integer.parseInt(request.getParameter("Id"));
//		   UserService us=new UserService();
		 IUserService us=new UserServiceImpl();
		   User user =us.queryUserById(id);
		   request.setAttribute("user", user);
		   request.getRequestDispatcher("userinfo.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
